package com.srit.vgt.main;

import com.alibaba.fastjson.JSONObject;
import com.srit.vgt.dao.DistrictDao;
import com.srit.vgt.entity.City;
import com.srit.vgt.entity.District;
import com.srit.vgt.entity.EcrInfo;
import com.srit.vgt.entity.Market;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Configurable;

import javax.annotation.PostConstruct;
import java.time.LocalDateTime;
import java.util.List;

@Configurable
@Slf4j
public class UploadInformation extends DaoInject {



    @PostConstruct
    public void upload() {
        log.info("start prepare data =====> {}", LocalDateTime.now().toString());
        Market market = marketDao.findAll().get(0);
        JSONObject all = new JSONObject();
        all.put("market", market);

        District district = districtDao.getById(market.getDistrictId());
        all.put("district", district);

        City city = cityDao.getById(market.getCityId());
        all.put("city", city);


        List<EcrInfo> ecrInfos = ecrInfoDao.findAll();
        all.put("EcrInfo",null);


    }
}
